<div class="con-menu">
    <ul class="menulist">
        <?php foreach($cat_list as $item) { ?>
        <li class="menuli">
            <?php if (isset($item['sub_cat_list']) && !empty($item['sub_cat_list'])) { ?>
                <a href="javascript:void(0);" <?php if (in_array($cat_id, array_keys($item['sub_cat_list']))) { ?>class="on"<?php } ?>><?php echo $item['name']; ?></a>
                <dl class="menusub <?php if (in_array($cat_id, array_keys($item['sub_cat_list']))) { ?>active<?php } ?>">
                <?php foreach($item['sub_cat_list'] as $subItem) { ?>
                <dd><a href="<?php echo U('About/detail', array('nav_flag' => $nav_flag, 'cat1_id' => $cat1_id, 'cat_id' => $subItem['id'])); ?>" <?php if ($cat_id == $subItem['id']) { ?>class="on"<?php } ?>>- <?php echo $subItem['name']; ?></a></dd>
                <?php } ?>
            </dl>
            <?php } else { ?>
            <a href="<?php echo U('About/detail', array('nav_flag' => $nav_flag, 'cat1_id' => $cat1_id, 'cat_id' => $item['id'])); ?>" <?php if ($cat_id == $item['id']) { ?>class="on"<?php } ?>><?php echo $item['name']; ?></a>
            <?php } ?>
        </li>
        <?php } ?>
        <?php if ($nav_flag == "about") { ?>
        <li class="menuli">
            <a href="<?php echo U('About/contactUs', array('nav_flag' => $nav_flag, 'sidebar_flag' => 'about', 'cat1_id' => $cat1_id)); ?>" <?php if ('about' == $_GET['sidebar_flag']) { ?>class="on"<?php } ?>>联系我们</a>
        </li>
        <?php } ?>
    </ul>
</div>
<script type="text/javascript">
    $(document).ready(function(){
        //主菜单点击展开子菜单
        $(".menulist>.menuli>a").on('click', function(){
            var active = "active";
            var $this = $(this);
            $this.addClass("on");
            var $menusub = $this.siblings('.menusub');
            if($menusub){
                $menusub.toggleClass(active);
            }
        });
    });
</script>